package com.icoolkj.ms.system.controller;

import com.icoolkj.ms.common.core.response.ServerResponseEntity;
import com.icoolkj.ms.common.database.dto.PageDTO;
import com.icoolkj.ms.common.database.vo.PageVO;
import com.icoolkj.ms.system.model.SysDictType;
import com.icoolkj.ms.system.service.ISysDictTypeService;
import com.icoolkj.ms.system.vo.SysDictTypeVO;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 数据字典信息
 * 
 * @author icoolkj
 */
@RestController
@RequestMapping("/system/dict/type")
public class SysDictTypeController
{
    @Autowired
    private ISysDictTypeService dictTypeService;

    @GetMapping("/list")
    public ServerResponseEntity<List<SysDictType>> list()
    {
        SysDictType sysDictType = new SysDictType();
        List<SysDictType> sysDictTypes = dictTypeService.selectDictTypeList(sysDictType);
        return ServerResponseEntity.success(sysDictTypes);
    }

    @GetMapping("/pageList")
    public ServerResponseEntity<PageVO<SysDictTypeVO>> pageList(@Valid PageDTO pageDTO)
    {
        SysDictType sysDictType = new SysDictType();
        PageVO<SysDictTypeVO> sysDictTypes = dictTypeService.selectPageDictTypeList(pageDTO, sysDictType);
        return ServerResponseEntity.success(sysDictTypes);
    }

}
